<template>
    <div class="main1">
        <div class="chead">
            <el-breadcrumb separator="/">
              <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
              <el-breadcrumb-item>添加上机课程</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="cmain">
            <el-select v-model="week" multiple placeholder="请选择哪几周上机" class="select1">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
            <el-select v-model="classmate" multiple placeholder="请选择上机班级" class="select2">
                <el-option
                  v-for="item in clsoptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
            <el-cascader v-model="section" :props="props" :options="woptions" clearable placeholder="请选择具体的上机时间段" class="text1"></el-cascader>
            <el-cascader v-model="course" :options="coptions" clearable placeholder="请选择上机的课程信息" class="text2"></el-cascader>
             <div class="foot">
                <div class="rad">
                    <el-radio v-model="radio" label="1">普通机房</el-radio>
                    <el-radio v-model="radio" label="2">机房实验室</el-radio>
                </div>
                <div class="number">
                    <el-input v-model="labId" placeholder="请输入上机人数"></el-input>
                </div>
             </div>
             <div class="btn">
                <el-button type="primary" round>添加</el-button>
             </div>
        </div>
    </div>
</template>

<script>
import global from '../../Global'
export default {
  data () {
    return {
      options: [{
        value: '1',
        label: '第一周'
      }, {
        value: '2',
        label: '第二周'
      }, {
        value: '3',
        label: '第三周'
      }, {
        value: '4',
        label: '第四周'
      }, {
        value: '5',
        label: '第五周'
      }, {
        value: '6',
        label: '第六周'
      }, {
        value: '7',
        label: '第七周'
      }, {
        value: '8',
        label: '第八周'
      }, {
        value: '9',
        label: '第九周'
      }, {
        value: '10',
        label: '第十周'
      }, {
        value: '11',
        label: '第十一周'
      }, {
        value: '12',
        label: '第十二周'
      }, {
        value: '13',
        label: '第十三周'
      }, {
        value: '14',
        label: '第十四周'
      }, {
        value: '15',
        label: '第十五周'
      }, {
        value: '16',
        label: '第十六周'
      }, {
        value: '17',
        label: '第十七周'
      }, {
        value: '18',
        label: '第十八周'
      }, {
        value: '19',
        label: '第十九周'
      }, {
        value: '20',
        label: '第二十周'
      }],
      woptions: [
        {
          value: '1',
          label: '周一',
          children: [{
            value: '1',
            label: '1-2'
          }, {
            value: '2',
            label: '3-4'
          }, {
            value: '3',
            label: '5-6'
          }, {
            value: '4',
            label: '7-8'
          }, {
            value: '5',
            label: '9-10'
          }]
        },
        {
          value: '2',
          label: '周二',
          children: [{
            value: '1',
            label: '1-2'
          }, {
            value: '2',
            label: '3-4'
          }, {
            value: '3',
            label: '5-6'
          }, {
            value: '4',
            label: '7-8'
          }, {
            value: '5',
            label: '9-10'
          }]
        },
        {
          value: '3',
          label: '周三',
          children: [{
            value: '1',
            label: '1-2'
          }, {
            value: '2',
            label: '3-4'
          }, {
            value: '3',
            label: '5-6'
          }, {
            value: '4',
            label: '7-8'
          }, {
            value: '5',
            label: '9-10'
          }]
        },
        {
          value: '4',
          label: '周四',
          children: [{
            value: '1',
            label: '1-2'
          }, {
            value: '2',
            label: '3-4'
          }, {
            value: '3',
            label: '5-6'
          }, {
            value: '4',
            label: '7-8'
          }, {
            value: '5',
            label: '9-10'
          }]
        },
        {
          value: '5',
          label: '周五',
          children: [{
            value: '1',
            label: '1-2'
          }, {
            value: '2',
            label: '3-4'
          }, {
            value: '3',
            label: '5-6'
          }, {
            value: '4',
            label: '7-8'
          }, {
            value: '5',
            label: '9-10'
          }]
        },
        {
          value: '6',
          label: '周六',
          children: [{
            value: '1',
            label: '1-2'
          }, {
            value: '2',
            label: '3-4'
          }, {
            value: '3',
            label: '5-6'
          }, {
            value: '4',
            label: '7-8'
          }, {
            value: '5',
            label: '9-10'
          }]
        },
        {
          value: '7',
          label: '周日',
          children: [{
            value: '1',
            label: '1-2'
          }, {
            value: '2',
            label: '3-4'
          }, {
            value: '3',
            label: '5-6'
          }, {
            value: '4',
            label: '7-8'
          }, {
            value: '5',
            label: '9-10'
          }]
        }
      ],
      coptions: [
        {
          value: 'Web基础',
          label: 'Web基础',
          children: [{
            value: '于艳丽',
            label: '于艳丽'
          }]
        }
      ],
      clsoptions: [
        {
          value: '1',
          label: '计科186'
        }, {
          value: '2',
          label: '计科185'
        }, {
          value: '3',
          label: '计科184'
        }, {
          value: '4',
          label: '计科183'
        }, {
          value: '5',
          label: '计科182'
        }, {
          value: '6',
          label: '计科18'
        }],
      props: { multiple: true },
      week: [],
      time: [],
      course: [],
      classmate: [],
      radio: '3',
      labId: ''
    }
  },
  methods: {
    async add () {
      this.$http.defaults.headers.post['Content-Type'] = 'application/json'
      await this.$http.post('/course/addCourse', {
        weeks: this.week,
        days: ,
        labId: ,
        courseId: this.time,
        course: this.course,
        userId: global.userId,
        sections: 
      }).then(res => {
        console.log(res)
        if (res.status === 200) return this.$message.success('课程添加成功~~')
        if (res.status !== 200) return this.$message.error('课程添加失败~~')
      }, err => {
        console.log(err)
      })
    }
  }
}
</script>

<style lang="less" scoped>
.main1{
  height: 55%;
  background-color:white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
}
.chead{
 box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
 height: 50px;
}
.cmain{
  position: relative;
  top: 40px;
  left: 4%;
  height: 80%;
}
.select1{
  width: 80%;
}
.select2{
  width: 80%;
  position: relative;
  top: 5%;
}
.text1{
  width: 80%;
  position: relative;
  top: 10%;
}
.text2{
  width: 80%;
  position: relative;
  top: 15%;
}
.foot{
  width: 80%;
  position: relative;
  top: 20%;
  .rad{
    position: relative;
    top: 7px;
    float: right;
  }
  .number{
    width: 30%;
  }
}
.btn{
  width: 80%;
  position: relative;
  top: 25%;
  .el-button{
    width: 100%;
  }
}
.span{
  font-size: 15px;
}
</style>
